package com.hcnow.common

import org.springframework.web.servlet.HandlerInterceptor
import org.springframework.web.servlet.ModelAndView
import java.lang.Exception
import javax.servlet.http.HttpServletRequest
import javax.servlet.http.HttpServletResponse

class CommonHttpInterceptor() : HandlerInterceptor {
    override fun preHandle(request: HttpServletRequest, response: HttpServletResponse, handler: Any?): Boolean {
        val token = request.getHeader("Authorization");
//        if (token.isNullOrEmpty()) {
//            throw AuthorizationException("token is null");
//        }
//        if(null == JWTUtils.unsign(token,LoginLog::class.java)){
//            throw AuthorizationException("token is not valid");
//        }
        return true;
    }

    override fun postHandle(request: HttpServletRequest, response: HttpServletResponse, handler: Any?, modelAndView: ModelAndView?) {

    }

    override fun afterCompletion(request: HttpServletRequest, response: HttpServletResponse, handler: Any?, ex: Exception?) {

    }
}